package org.zhadoop.stream.cql.semanticanalyzer.analyzecontext;

import java.util.List;

import org.zhadoop.stream.api.streams.Schema;
import org.zhadoop.stream.cql.exception.SemanticAnalyzerException;
import org.zhadoop.stream.cql.semanticanalyzer.parser.context.ParseContext;

import com.google.common.collect.Lists;

/**
 * insert 语句语义分析内容
 * @author zwd
 *
 */
public abstract class InsertOnlyAnalyzeContext extends AnalyzeContext{

	private String outputStreamName;
	
	private Schema outputSchema;
	
    private boolean isPipeStreamNotCreated = false;
	
	@Override
	public void setParseContext(ParseContext parseContext) {
		
	}

	@Override
	public void validateParseContext() throws SemanticAnalyzerException {}

	@Override
	public List<Schema> getCreatedSchemas() {
		List<Schema> schemas = Lists.newArrayList();
		if (isPipeStreamNotCreated)
        {
            schemas.add(outputSchema);
        }
        return schemas;
	}

	public String getOutputStreamName() {
		return outputStreamName;
	}

	public void setOutputStreamName(String outputStreamName) {
		this.outputStreamName = outputStreamName;
	}

	public Schema getOutputSchema() {
		return outputSchema;
	}

	public void setOutputSchema(Schema outputSchema) {
		this.outputSchema = outputSchema;
	}

	public boolean isPipeStreamNotCreated() {
		return isPipeStreamNotCreated;
	}

	public void setPipeStreamNotCreated(boolean isPipeStreamNotCreated) {
		this.isPipeStreamNotCreated = isPipeStreamNotCreated;
	}

}
